***********************************************************************************************
***
***	INTERTEMPORAL EVIDENCE ON THE STRATEGY OF POPULISM IN THE US (Gennaro, Lecce, Morelli)
***	Replication Package
***  
*** Appendix - Table A7
***
***********************************************************************************************



clear
est clear 

* Indicate location of the replication package here
cd "/Replication Package"


* Presidential
use "3_data/for_analysis/presidential_election_complete.dta", clear

egen mch_s = std(mch)
egen pop_dim2_s = std(pop_dim2)
drop if mch_s==.

eststo m1: reg pop_dim2_s complexity length i.mcode, cl(MSANAME)
eststo m2: reg pop_dim2_s complexity trump mch_s swing length i.mcode, cl(MSANAME)
eststo m3: reg pop_dim2_s complexity i.trump##c.mch_s##i.swing length i.mcode, cl(MSANAME)


* Congress
use "3_data/for_analysis/congress_election_both.dta", clear

* Sample and controls
keep if uncont==0 & indep==0
global controls "female i.age_cat_num i.ethnicity2 i.educ_cat len_words i.election_year"

eststo m4: areg pop_dim2_s complexity $controls , a(state) cluster(district)
eststo m5: areg pop_dim2_s complexity outsider_correct econ competitive $controls , a(state) cluster(district)
eststo m6: areg pop_dim2_s complexity i.outsider_correct##i.competitivedistricts##c.econ $controls , a(state) cluster(district)


*Save 
esttab m1 m2 m3 m4 m5 m6 using "4_results/tables/tabA7.tex", f label replace booktabs alignment(D{.}{.}{-1}) ///
s(N r2, fmt(0 2) label("Observations" "R-squared")) ///
nomtitles star(* 0.10 ** 0.05 *** 0.01) r2 b(3) se(3) brac nonotes
